package com.house.house.entity;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.house.house.util.enums.Sex;

@Entity
@Table(name="t_owner")
public class Owner {
	private Long ownerId;
	private String ownerName;
	private Sex sex;
	private String ownerPhone;
	private String email;
	private String idCard;
	private String  photo;
	private List<House> house = new ArrayList<House>();
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	public Long getOwnerId() {
		return ownerId;
	}
	public String getOwnerName() {
		return ownerName;
	}
	@Enumerated(EnumType.STRING)
	public Sex getSex() {
		return sex;
	}
	public String getOwnerPhone() {
		return ownerPhone;
	}
	public String getEmail() {
		return email;
	}
	public String getIdCard() {
		return idCard;
	}
	public String getPhoto() {
		return photo;
	}
	@JsonIgnore
	@OneToMany(cascade= CascadeType.ALL,mappedBy="owner",fetch=FetchType.LAZY)
	public List<House> getHouse() {
		return house;
	}
	public void setOwnerId(Long ownerId) {
		this.ownerId = ownerId;
	}
	public void setOwnerName(String ownerName) {
		this.ownerName = ownerName;
	}
	public void setSex(Sex sex) {
		this.sex = sex;
	}
	public void setOwnerPhone(String ownerPhone) {
		this.ownerPhone = ownerPhone;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public void setIdCard(String idCard) {
		this.idCard = idCard;
	}
	public void setPhoto(String photo) {
		this.photo = photo;
	}
	public void setHouse(List<House> house) {
		this.house = house;
	}

}
